Record element type of first element in LazyDynaList.transform - #434
Open
rootvector2 wants to merge 2 commits into
Open
Record element type of first element in LazyDynaList.transform#434rootvector2 wants to merge 2 commits into
rootvector2 wants to merge 2 commits into
Conversation
garydgregory
requested changes
Aug 14, 2026
garydgregory
left a comment
Member
There was a problem hiding this comment.
Hello @rootvector2
Thank you for the PR. What about adding tests for:
- POJO first element -> WrapDynaBean path, toArray() returning the POJO class and toDynaBeanArray() returning WrapDynaBean[].
- DynaBean first element -> elementType = DynaBean subclass, elementDynaBeanType = same subclass.
- addAll(Collection) and addAll(int,Collection) with an untyped list.
- get/growList after type has been fixed by first population.
- toDynaBeanArray() type correctness for the untyped case.
TY!
Contributor
Author
|
Added all five: POJO first element ( |
Member
|
@rootvector2 Please rebase on git master to resolve a test snafu. |
rootvector2
force-pushed
the
lazydynalist-element-type
branch
from
August 18, 2026 10:39
01bdbff to
4b1c340
Compare
Contributor
Author
|
Rebased on current master, full |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
transformnever records the element type for the first non-null element, so the homogeneity check at the end of the method is dead code and mismatched types are silently accepted (add(new HashMap<>())thenadd("a POJO String")is accepted), andtoArray()/toDynaBeanArray()throwNullPointerExceptionfromArray.newInstance(elementType, size())becauseelementTypestays null; found while auditing the lazy dyna utilities, fixed by recording the type from the first populated element, mirroringsetElementDynaClass, which also restores the documentedMap[]round-trip in Example 1.mvn; that'smvnon the command line by itself.